package tma.sdc.batch8.mobile10.shareboard.service;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.codehaus.jettison.json.JSONArray;

import javax.ws.rs.core.Response;

import tma.sdc.batch8.mobile10.shareboard.dao.CoursesListDAO;
import tma.sdc.batch8.mobile10.shareboard.dao.StudentDAO;

@Path("/couselist")
public class CourseListServices {

	@GET
	@Path("/listall")
	@Produces(MediaType.APPLICATION_JSON)
	public Response listAllCourses()
			throws Exception {

		String returnString = null;

		try {
			CoursesListDAO dao = new CoursesListDAO();

			returnString = dao.queryListAllCourses().toString();

		} catch (Exception e) {
			e.printStackTrace();
			return Response.status(500)
					.entity("Server was not able to process your request")
					.build();
		}

		return Response.ok(returnString).build();
	}

}